package com.rb.module;

import com.rb.dto.UserDto;
import com.rb.service.UserService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;

import java.util.List;

/**
 * Created by root on 2017/12/13.
 */
@IocBean
@At("/user")
public class UserModule {

    @Inject
    private UserService userS;

    @At("/")
    @Ok("json")
    public List<UserDto> index() {
        return userS.query();
    }

    @At("/list")
    @Ok("json")
    @POST
    public List<UserDto> list(@Param("id") String id) {
        return userS.query(UserDto.class,"user.list",null);
    }
}
